package com.kitwee.serialport.data.dao;


import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import com.kitwee.serialport.data.model.SerialPortData;

import java.util.List;

@Dao
public interface SerialPortDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(SerialPortData... data);

    @Delete
    void delete(SerialPortData... data);

    @Query("SELECT * FROM serial_port_data LIMIT :rows")
    List<SerialPortData> query(int rows);

    @Query("SELECT * FROM serial_port_data WHERE flag = :flag")
    SerialPortData query(String flag);

}
